﻿#include "EditorSimpleMessageNotificationItemViewModel.h"
#include "EditorSimpleMessageNotificationItemModel.h"

#include "Asset/EditorDefaultPackage.h"


void REditorSimpleMessageNotificationItemViewModel::BindModel(TSharedObjectPtr<REditorNotificationItemModel> InModel)
{
    Super::BindModel(InModel);
    SimpleMessageModel=InModel;

    Info=REditorDefaultPackage::Get()->GetIcon(U"CodiconInfo");
    Warning=REditorDefaultPackage::Get()->GetIcon(U"CodiconWarning");
    Error=REditorDefaultPackage::Get()->GetIcon(U"CodiconError");
}

TSharedObjectPtr<RTexture2D> REditorSimpleMessageNotificationItemViewModel::GetIcon() const
{
    switch(SimpleMessageModel->Type)
    {
        case REditorSimpleMessageNotificationItemModel::EType::Info:
            return Info;
        case REditorSimpleMessageNotificationItemModel::EType::Warning:
            return Warning;
        case REditorSimpleMessageNotificationItemModel::EType::Error:
            return Error;
        default:
            assert(false);
            return nullptr;
    }
}

CString REditorSimpleMessageNotificationItemViewModel::GetMessage() const
{
    return SimpleMessageModel->Message;
}
